package com.ellwood.copyright.infrastructure.system.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ellwood.copyright.common.core.base.MapperFactory;
import com.ellwood.copyright.infrastructure.system.entity.SysUserEntity;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Map;

/**
 * @ProjectName: ell-copyright-pro
 * @PackageName: com.ellwood.copyright.infrastructure.mapper.system
 * @ClassName: SysUserMapper
 * @Description: // 用户mapper
 * @Author: Ellwood
 * @CreateDate: 2024/11/18 - 15:21
 * @Version: V1.0.0
 */
@Mapper
public interface SysUserMapper extends MapperFactory<SysUserEntity> {

    /**
     * 查询所有，根据条件查询，不分页
     * @param params 查询参数
     * @return 返回查询结果
     */
    List<SysUserEntity> findAll(Map<String, Object> params);

    default  SysUserEntity getByAccount(String account) {
        return this.selectOne(new LambdaQueryWrapper<SysUserEntity>().eq(SysUserEntity::getAccount,account));
    }

    default  SysUserEntity getByPhone(String phone) {
        return this.selectOne(new LambdaQueryWrapper<SysUserEntity>().eq(SysUserEntity::getPhone,phone));
    }
}
